#include "EntityUpdater.h"
#include "IContext.h"
#include "World.h"
#include "Entity.h"
#include "PhysicalProperty.h"
#include "Vectors.h"


namespace steam
{
	namespace boiler
	{

		EntityUpdater::EntityUpdater() : m_noOfEntites(1)
		{
			for (SMUInt i = 0; i<m_noOfEntites; i++)
			{
				firebox::Entity* entity = firebox::getContext().getWorld().getFactory().create<firebox::Entity>();
				firebox::PhysicalProperty* phyProp = entity->getProperty<firebox::PhysicalProperty>();
				phyProp->setPosition(base::Vector3(20,0,0));
				firebox::getContext().getWorld().addEntity(entity);
				m_entities.push_back(entity);
			}
		}

		EntityUpdater::~EntityUpdater()
		{

		}

		void EntityUpdater::update( SMFloat timeStep )
		{
			for (Entities::const_iterator it = m_entities.begin(), itE = m_entities.end(); it != itE; it++)
			{
				firebox::PhysicalProperty* phyProp = (*it)->getProperty<firebox::PhysicalProperty>();
				base::Vector3 curPos = phyProp->getPosition();
				curPos.x += 0.2;
				phyProp->setPosition(curPos);
			}
		}

	}
}